/**
 * 报表设计公司(2011)
 */
package com.reportgear.designer.action.file;

import java.awt.event.ActionEvent;

import com.reportgear.core.util.ImageUtils;
import com.reportgear.designer.action.ReportAction;
import com.reportgear.report.context.ReportContext;
import com.reportgear.report.model.ReportModel;
import com.reportgear.report.model.calculator.CalculatorHelper;
import com.reportgear.report.print.Printer;
import com.reportgear.report.print.ReportPageIterator;
import com.reportgear.report.view.JWorksheet;

/**
 * @version 1.0 2011-3-24
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ANNCSR 2.0
 */
public class PrintReportAction extends ReportAction {

	public PrintReportAction() {
		setName("打印");
		setSmallIcon(ImageUtils.readIcon("/resources/images/file/print.png"));
	}

	public void actionPerformed(ActionEvent e) {
		JWorksheet worksheet = ReportContext.INSTANCE.getCurrentWorkSheet();
		ReportModel report = worksheet.getReportModel();

		ReportModel currReport = CalculatorHelper.calculateSalaryReportModel(report);

		new Printer().print(new ReportPageIterator(currReport), currReport);
	}
}
